Telegram Group & Telegram Channel
SOLID Principles
(part 4)

رابع مبدأ(ISP) Interface segregation principle

- “ Clients should not be forced to depend on methods they do not use”

إذا كان يوجد كلاس يرث من Interface المفروض لا يعمل Impalement إلا للـ methods اللي هو يحتاجها .

لذلك عند بناء Interface يجب ان يكون كُل الـ methods الموجودة مرتبطة مع بعض مالم يتم تقسيمها إلا أكثر من Interface وهذا المبدأ شبيه إلا حدٍ ما من مبدأ SRP.

واقصد هُنا بالـ Interface أي جزء يستخدمه الـ client سواءً Class او Interface

مثلاً كان عندك Interface لطرق الدفع ، وشخص آخر حب يأخذ منك الواجهة هذي ويستخدمها في طريقة الدفع اونلاين

فأنت قولت له عشان تستخدم الواجهة لازم تعمل Implement للدالة الخاصة بالدفع اونلاين وكمان للدالة الخاصة بالدفع كاش عشان يشتغل معاك، طيب هو ما يحتاج الدفع كاش تجبره عليها ليش🙄؟

لذلك يتم تقسيم Interface وتكون كُل Interface خاصة بطريقة دفع مُعينه وبكذا حققنا مبدأ ISP وبنفس الوقت مبدأ SRP.

يتبع..



tg-me.com/beginprogrammer/639
Create:
Last Update:

SOLID Principles
(part 4)

رابع مبدأ(ISP) Interface segregation principle

- “ Clients should not be forced to depend on methods they do not use”

إذا كان يوجد كلاس يرث من Interface المفروض لا يعمل Impalement إلا للـ methods اللي هو يحتاجها .

لذلك عند بناء Interface يجب ان يكون كُل الـ methods الموجودة مرتبطة مع بعض مالم يتم تقسيمها إلا أكثر من Interface وهذا المبدأ شبيه إلا حدٍ ما من مبدأ SRP.

واقصد هُنا بالـ Interface أي جزء يستخدمه الـ client سواءً Class او Interface

مثلاً كان عندك Interface لطرق الدفع ، وشخص آخر حب يأخذ منك الواجهة هذي ويستخدمها في طريقة الدفع اونلاين

فأنت قولت له عشان تستخدم الواجهة لازم تعمل Implement للدالة الخاصة بالدفع اونلاين وكمان للدالة الخاصة بالدفع كاش عشان يشتغل معاك، طيب هو ما يحتاج الدفع كاش تجبره عليها ليش🙄؟

لذلك يتم تقسيم Interface وتكون كُل Interface خاصة بطريقة دفع مُعينه وبكذا حققنا مبدأ ISP وبنفس الوقت مبدأ SRP.

يتبع..

BY بدايه مبرمج




Share with your friend now:
tg-me.com/beginprogrammer/639

View MORE
Open in Telegram


بدايه مبرمج Telegram | DID YOU KNOW?

Date: |

Importantly, that investor viewpoint is not new. It cycles in when conditions are right (and vice versa). It also brings the ineffective warnings of an overpriced market with it.Looking toward a good 2022 stock market, there is no apparent reason to expect these issues to change.

How Does Bitcoin Mining Work?

Bitcoin mining is the process of adding new transactions to the Bitcoin blockchain. It’s a tough job. People who choose to mine Bitcoin use a process called proof of work, deploying computers in a race to solve mathematical puzzles that verify transactions.To entice miners to keep racing to solve the puzzles and support the overall system, the Bitcoin code rewards miners with new Bitcoins. “This is how new coins are created” and new transactions are added to the blockchain, says Okoro.

بدايه مبرمج from tw


Telegram بدايه مبرمج
FROM USA